<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .big {
            width: 300px;
            height: 300px;
            background-color: #f0f0f0;
            border: 1px solid #999;
        }
        .middle {
            width: 200px;
            height: 200px;
            background-color: #e15761;
        }
        .small {
            width: 150px;
            height: 150px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <p>阻止冒泡</p>
    <div class="big" onclick="fn('big', event)">
        <div class="middle" onclick="fn('middle', event)">
            <div class="small" onclick="fn('small', event)"></div>
        </div>
    </div>
    <script>
        function fn (val, e) {
            // 阻止冒泡。避免事件向上传递
            e.stopPropagation(); // 普通浏览器
            event.cancelBubble=true; // ie浏览器
            console.log(val);
        }
    </script>
</body>
</html>